using System;
using System.Collections.Generic;
using CLELCore.Assembly.StreamTables.StreamTableRows;

namespace CLELCore.Assembly.StreamTables
{
	public class NestedClassTable : StreamTable
	{
		List<NestedClassTableRow> _table;

		public int Count
		{
			get
			{
				return _table.Count;
			}
		}
		
		public NestedClassTableRow Get(int index)
		{
			if(_table == null || index < 0 || index >= _table.Count)
				throw new IndexOutOfRangeException("Index out of range");
			return _table[index];
		}

		public void Set(int index,NestedClassTableRow row)
		{
			if(_table == null || index < 0 || index >= _table.Count)
				throw new IndexOutOfRangeException("Index out of range");
			_table[index] = row;
		}

		public NestedClassTable() : base(NESTEDCLASS_TABLE)
		{
			_table = new List<NestedClassTableRow>();
		}

		public void Add(NestedClassTableRow row)
		{
			_table.Add(row);
		}
	}
}
